import { cached } from '@/utils'
import { getEnumDict, ENUM_MAP } from './enumDict'

export const STATUS_ENUM = { NORMAL: '0', LOCK: '1', SCRAP: '2' }

const tags = { 0: 'success', 1: 'warning', 2: 'danger' }

export async function getChangeStatus() {
  const { data } = await getEnumDict(ENUM_MAP.changeStatus)
  return data
}

export function getChangeStateTag(val) {
  return cached((val) => tags[val])
}
